﻿namespace EyeOpen.Validation.Test
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using SharpTestsEx;

    /// <summary>
    /// Tests the <see cref="RequiredValidator"/> class.
    /// </summary>
    [TestClass]
    public class RequiredValidatorTest
    {
        private readonly IValidator validator = new RequiredValidator();

        /// <summary>
        /// Validates an empty string expected validation fails.
        /// </summary>
        [TestMethod]
        [Owner("Matteo Migliore")]
        [Description("Unit.CodeBase.Validation")]
        public void ValidateAnEmptyStringExpectedValidationFails()
        {
            validator
                .IsValid(string.Empty)
                .Should("RequiredValidator validate well an empty string.")
                .Be
                .False(); 
        }

        /// <summary>
        /// Validates a <c>null</c> string expected validation fails.
        /// </summary>
        [TestMethod]
        [Owner("Matteo Migliore")]
        [Description("Unit.CodeBase.Validation")]
        public void ValidateANullStringExpectedValidationFails()
        {                                           
            validator
                .IsValid(null)
                .Should("RequiredValidator validate well a null string.")
                .Be
                .False();
        }

        /// <summary>
        /// Validates the a spaces only string expected validation fails.
        /// </summary>
        [TestMethod]
        [Owner("Matteo Migliore")]
        [Description("Unit.CodeBase.Validation")]
        public void ValidateASpacesOnlyStringExpectedValidationFails()
        {
            const string Spaces = "   ";

            validator
                .IsValid(Spaces)
                .Should("RequiredValidator validate well a spaces string.")
                .Be
                .False();
        }
    }
}